{template 'common/header-storex'}

<div class="wn-main">
	<div class="wn-main__head">应用</div>
	<div class="wn-main__content">
		<div class="wn-tabs">
			<div class="wn-tabs__item {if $op == 'new'}wn-tabs__item--active{/if}">
				<a class="wn-tabs__link" href="{php echo $this->createWebUrl('shop_market', array('op' => 'new', 'storeid' => $_GPC['storeid']))}">新用户活动</a>
			</div>
			<div class="wn-tabs__item {if $op == 'cut'}wn-tabs__item--active{/if}">
				<a class="wn-tabs__link" href="{php echo $this->createWebUrl('shop_market', array('op' => 'cut', 'storeid' => $_GPC['storeid']))}">满减/赠活动</a>
			</div>
			<div class="wn-tabs__item {if $op == 'pickup'}wn-tabs__item--active{/if}">
				<a class="wn-tabs__link" href="{php echo $this->createWebUrl('shop_market', array('op' => 'pickup', 'storeid' => $_GPC['storeid']))}">自提活动</a>
			</div>
			{if $store_info['store_type'] != 1}
			<div class="wn-tabs__item">
				<a class="wn-tabs__link" href="{php echo $this->createWebUrl('shop_sales_package', array('storeid' => $_GPC['storeid']))}">套餐管理</a>
			</div>
			{/if}
		</div>
		{if $op == 'new'}
		<form class="form-horizontal form" method="post" enctype="multipart/form-data">
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">活动时间</label>
				<div class="col-sm-9 col-xs-12">
					{php echo tpl_form_field_daterange('time_limit', array('start' => date('Y-m-d', $new_list['starttime']), 'end' => date('Y-m-d', $new_list['endtime'])));}
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">新用户立减</label>
				<div class="col-sm-3 col-xs-12">
					<div class="input-group">
						<span class="input-group-addon">新用户立减</span>
						<input type="text" name="back" value="{$new_list['items']}" class="form-control">
						<span class="input-group-addon">元</span>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">状态</label>
				<div class="col-sm-9 col-xs-12">
					<label class="radio-inline">
						<input type="radio" name="status" value="1" {if empty($new_list['status']) || $new_list['status'] == 1} checked {/if}/>启用
					</label>
					<label class="radio-inline">
						<input type="radio" name="status" value="2" {if $new_list['status'] == 2} checked {/if}/>禁用
					</label>
					<span class='help-block'>是否使用该活动</span>
				</div>
			</div>
			<div class="form-group col-sm-12">
				<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
				<input type="hidden" name="token" value="{$_W['token']}" />
				<input type="hidden" name="type" value="new" />
			</div>
		</form>
		{/if}
		{if $op == 'cut'}
		<form class="form-horizontal form" method="post" enctype="multipart/form-data">
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">选择减/赠</label>
				<div class="col-sm-9 col-xs-12">
					<label class="radio-inline">
						<input type="radio" name="type" value="cut" {if $cut_list['type'] == 'cut'}checked{/if}/>满减
					</label>
					<label class="radio-inline">
						<input type="radio" name="type" value="gift" {if $cut_list['type'] == 'gift'}checked{/if}/>满赠
					</label>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">活动时间</label>
				<div class="col-sm-9 col-xs-12">
					{php echo tpl_form_field_daterange('time_limit', array('start' => date('Y-m-d', $cut_list['starttime']), 'end' => date('Y-m-d', $cut_list['endtime'])));}
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">满减/赠</label>
				<div class="col-sm-3 col-xs-12">
					<div class="input-group">
						<span class="input-group-addon">满</span>
						<input type="text" name="condition" value="{$cut_list['items']['condition']}" class="form-control">
						<span class="input-group-addon">元</span>
						<span class="input-group-addon">减/赠</span>
						<input type="text" name="back" value="{$cut_list['items']['back']}" class="form-control">
						<span class="input-group-addon">元</span>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">状态</label>
				<div class="col-sm-9 col-xs-12">
					<label class="radio-inline">
						<input type="radio" name="status" value="1" {if empty($cut_list['status']) || $cut_list['status'] == 1} checked {/if}/>启用
					</label>
					<label class="radio-inline">
						<input type="radio" name="status" value="2" {if $cut_list['status'] == 2} checked {/if}/>禁用
					</label>
					<span class='help-block'>是否使用该活动</span>
				</div>
			</div>
			<div class="form-group col-sm-12">
				<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
				<input type="hidden" name="token" value="{$_W['token']}" />
			</div>
		</form>
		{/if}
		{if $op == 'pickup'}
		<form class="form-horizontal form" method="post" enctype="multipart/form-data">
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">活动时间</label>
				<div class="col-sm-9 col-xs-12">
					{php echo tpl_form_field_daterange('time_limit', array('start' => date('Y-m-d'), 'end' => date('Y-m-d', time() + 30 * 86400)));}
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">上店自提</label>
				<div class="col-sm-3 col-xs-12">
					<div class="input-group">
						<span class="input-group-addon">满</span>
						<input type="text" name="condition" value="{$pickup_list['items']['condition']}" class="form-control">
						<span class="input-group-addon">元</span>
						<span class="input-group-addon">打</span>
						<input type="text" name="back" value="{$pickup_list['items']['back']}" class="form-control">
						<span class="input-group-addon">折</span>
					</div>
					<span class='help-block'>折扣价 = 金额 * 折扣值 * 0.1</span>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">状态</label>
				<div class="col-sm-9 col-xs-12">
					<label class="radio-inline">
						<input type="radio" name="status" value="1" {if empty($pickup_list['status']) || $pickup_list['status'] == 1} checked {/if}/>启用
					</label>
					<label class="radio-inline">
						<input type="radio" name="status" value="2" {if $pickup_list['status'] == 2} checked {/if}/>禁用
					</label>
					<span class='help-block'>是否使用该活动</span>
				</div>
			</div>
			<div class="form-group col-sm-12">
				<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
				<input type="hidden" name="token" value="{$_W['token']}" />
				<input type="hidden" name="type" value="pickup" />
			</div>
		</form>
		{/if}
	</div>
</div>


{template 'common/footer-storex'}